<?php
include('../../inc/global.inc');
$url=$_SERVER['HTTP_REFERER'];
?>
<?php
if($_POST[act_tj]){
mysql_query("insert into link_type (link_class) values ('$_POST[link_class]')");
echo "<script>location='".$_POST[url]."';</script>";
}
?>
<?php
if($_POST['act_xg']){
mysql_query("update link_type  set link_class='$_POST[link_class]' where id='".$_POST['iid']."'");
echo "<script>location='".$_POST[url]."';</script>";
}
?>
<HTML>
<HEAD>
<TITLE>友情分类</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="../css/css.css" rel=stylesheet>
<script type='text/javascript' src="../js/islogin.js" charset="utf-8"></script>
</HEAD>
<BODY>
<center>
  <table width="50%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">友情分类&nbsp;&nbsp;<a href="javascript:history.go(-1)">返回</a></td>
    </tr>
  </table>
<?php
if($_GET[tj]){
?>
  <table width="50%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
  <form method="post" action="type_modify.php" onSubmit="return check()">
    <tr>
      <td height="30" colspan="2" align="center" bgcolor="#8DA8CF" style="padding-left:5px;">添加友情分类</td>
    </tr>
    <tr>
      <td width="38%" height="30" align="center" bgcolor="#FFFFFF"><span style="padding-left:5px;">友情分类名称</span> </td>
      <td width="62%" align="left" bgcolor="#FFFFFF" style="padding-left:2px;"><input name="link_class" type="text" id="link_class" size="18" maxlength="50"></td>
    </tr>
    <tr>
	<input type="hidden" name="act_tj" value="ok"><input type="hidden" name="url" value="<?=$url?>">
      <td height="30" colspan="2" align="center" bgcolor="#FFFFFF"><input type="submit" value="提交"></td>
    </tr>
	</form>
  </table>
  <?php
}
?>
  <?php
if($_GET['xg']){
$sql="select * from link_type where id=".$_GET['xg_id'];
$rs=mysql_query($sql);
$row=mysql_fetch_array($rs)
?>
<table width="50%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <form method="post" action="type_modify.php" onSubmit="return check()">
      <tr>
        <td height="30" colspan="2" align="center" bgcolor="#8DA8CF"><span style="padding-left:5px;">修改友情分类</span></td>
      </tr>
      <tr>
        <td width="39%" height="30" align="center" bgcolor="#FFFFFF"><span style="padding-left:5px;">友情分类名称</span></td>
        <td width="61%" align="left" bgcolor="#FFFFFF" style="padding-left:2px;">
		<input name="link_class" type="text" value="<?=$row[link_class]?>" size="18" maxlength="50"></td>
      </tr>
      <tr><input type="hidden" name="url" value="<?=$url?>">
        <input type="hidden" name="act_xg" value="ok"><input type="hidden" name="iid" value="<?=$row['id']?>">
        <td height="30" colspan="2" align="center" bgcolor="#FFFFFF"><input name="submit" type="submit" value="提交"></td>
      </tr>
    </form>
  </table>
  <?php
}?>
</center>
</BODY>
</HTML>
